<?php 
/* $Revision: 1.83 $ */
$PageSecurity = 100;

include ('includes/session.inc');
$title = _('Chức năng chính');

/*The module link codes are hard coded in a switch statement below to determine the options to show for each tab */
//$ModuleLink = array('orders', 'AR', 'AP', 'PO', 'stock', 'manuf', 'GL', 'system');
$ModuleLink = array('system');

/*The headings showing on the tabs accross the main index used also in WWW_Users for defining what should be visible to the user */
//$ModuleList = array(_('Sales'), _('Receivables'), _('Payables'), _('Purchases'), _('Inventory'), _('Manufacturing'), _('General Ledger'), _('Setup'));
$ModuleList = array(_('Hệ thống đối soát sản lượng'));

if (isset($_GET['Application'])) { /*This is sent by this page (to itself) when the user clicks on a tab */
    $_SESSION['Module'] = $_GET['Application'];
}

include ('includes/header.inc');
if (count($_SESSION['AllowedPageSecurityTokens']) == 1) {

    /* if there is only one security access and its 1 (it has to be 1 for this page came up at all)- it must be a customer log on need to limit the menu to show only the customer accessible stuff this is what the page looks like for customers logging in */
    
?>
<tr>
    <td class="menu_group_items"><!-- Orders transaction options -->
    <table class="table_index">
        <tr>
            <td class="menu_group_item">
            <?php echo "<a href='" . $rootpath . '/CustomerInquiry.php?' . SID . '&CustomerID=' . $_SESSION['CustomerID'] . "'><LI>" . _('Account Status') . '</LI></a>'; ?></td>
        </tr>
        <tr>
            <td class="menu_group_item">
            <?php echo "<a href='" . $rootpath . '/SelectOrderItems.php?' . SID . "&NewOrder=Yes'><LI>" . _('Place An Order') . '</LI></a>'; ?></td>
        </tr>
        <tr>
            <td class="menu_group_item">
            <?php echo "<LI><a href='" . $rootpath . '/SelectCompletedOrder.php?' . SID . "&SelectedCustomer=" . $_SESSION['CustomerID'] . "'>" . _('Order Status') . '</a></LI>'; ?></td>
        </tr>
    </table></td>
    <?php
    include ('includes/footer.inc');
    exit ;
    } else { /* Security settings DO allow seeing the main menu */
    ?>
    <table class="main_menu" width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td class="main_menu">
            <table class="main_menu">
                <tr>
                    <?php
                    $i = 0;

                    while ($i < count($ModuleLink)) {

                        // This determines if the user has display access to the module see config.php and header.inc
                        // for the authorisation and security code
                        if ($_SESSION['ModulesEnabled'][$i] == 1) {

                            // If this is the first time the application is loaded then it is possible that
                            // SESSION['Module'] is not set if so set it to the first module that is enabled for the user
                            if (!isset($_SESSION['Module']) OR $_SESSION['Module'] == '') {
                                $_SESSION['Module'] = $ModuleLink[$i];
                            }
                            if ($ModuleLink[$i] == $_SESSION['Module']) {
                                echo "<td class='main_menu_selected'><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . '&Application=' . $ModuleLink[$i] . "'>" . $ModuleList[$i] . '</a></td>';
                            } else {
                                echo "<td class='main_menu_unselected'><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . '&Application=' . $ModuleLink[$i] . "'>" . $ModuleList[$i] . '</a></td>';
                            }
                        }
                        $i++;
                    }
                    ?>
                </tr>
            </table></td>
        </tr>
    </table>
    <?php
switch ($_SESSION['Module']) {

Case 'PO': /* them vao cac module */
break;

/* ****************************** HE THONG DOI SOAT ******************************** */

Case 'system': //SYSTEM

    ?>
    <table width="100%">
        <tr>
            <td valign="top" class="menu_group_area">
            <table width="100%">
                <?php OptionHeadings(); ?>
                <tr>
                    <td class="menu_group_items">
                    <table width="100%" class="table_index">
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/ListSinger.php?' . SID . "'><LI>" . _('Danh sách Ca Sĩ') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/ListComposer.php?' . SID . "'><LI>" . _('Danh sách Nhạc Sĩ') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/ListAlbum.php?' . SID . "'><LI>" . _('Danh sách Album') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/ListSongType.php?' . SID . "'><LI>" . _('Danh sách thể loại bài hát') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/ListPartner.php' . SID . "'><LI>" . _('Danh sách Đối Tác') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/ListPartnerPrices.php' . SID . "'><LI>" . _('Danh sách Giá Đối Tác') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/ListSong.php?' . SID . "'><LI>" . _('Kho dữ liệu bài hát') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . "/ListSongNotDB.php?" . SID . "'><LI>" . _('Danh sách bài hát không có trong kho') . '</LI></a>'; ?></td>
                        </tr>
                        <!--
                        <tr>
                        <td class="menu_group_item">
                        <?php echo "<a href='".$rootpath.'/#?'.SID."'><LI>"._('Tìm kiếm thông tin bài hát').'</LI></a>'; ?>
                        </td>
                        </tr>-->
                    </table></td>
                    <td class="menu_group_items">
                    <table width="100%" class="table_index">
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . "/YieldRevenueInformation.php?" . SID . "'><LI>" . _('Thông kê đối soát doanh thu của ca, nhạc sỹ') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <tr>
                                <td class="menu_group_headers">
                                <div align="center">
                                    <?php echo _('Hỗ trợ import Excel'); ?>
                                </div></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ImportExcelSinger.php?' . SID . "'><LI>" . _('Import Excel thông tin ca sỹ') . '</LI></a>'; ?></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ImportExcelComposer.php?' . SID . "'><LI>" . _('Import Excel thông tin nhạc sỹ') . '</LI></a>'; ?></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ImportExcelSong.php?' . SID . "'><LI>" . _('Import Excel kho dữ liệu bài hát') . '</LI></a>'; ?></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ImportExcelOutput.php?' . SID . "'><LI>" . _('Import Excel sản lượng hàng tháng của đối tác') . '</LI></a>'; ?></td>
                            </tr></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <tr>
                                <td class="menu_group_headers">
                                <div align="center">
                                    <?php echo _('Báo cáo sản lượng, đối soát'); ?>
                                </div></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ReportCrossCheckInformation.php?' . SID . "'><LI>" . _('Bảng xác nhận sản lượng doanh thu theo tháng, quý') . '</LI></a>'; ?></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ReportYieldRevenueInformation.php?' . SID . "'><LI>" . _('Biên bản đối soát theo tháng, quý') . '</LI></a>'; ?></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ReportSummaryYieldRevenue.php?' . SID . "'><LI>" . _('Bảng tổng hợp sản lượng đối soát theo tháng, quý') . '</LI></a>'; ?></td>
                            </tr>
                            <tr>
                                <td class="menu_group_item">
                                <?php echo "<a href='" . $rootpath . '/ReportNerverExchanged.php?' . SID . "'><LI>" . _('Bảng danh sách các bài hát chưa từng có sản lượng') . '</LI></a>'; ?></td>
                            </tr></td>
                        </tr>
                    </table></td>
                    <td class="menu_group_items">
                    <table width="100%" class="table_index">
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/CompanyPreferences.php?' . SID . "'><LI>" . _('Thông tin công ty') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/WWW_Users.php?' . SID . "'><LI>" . _('Quản lí người dùng') . '</LI></a>'; ?></td>
                        </tr>
                        <tr>
                            <td class="menu_group_item">
                            <?php echo "<a href='" . $rootpath . '/WWW_Access.php?' . SID . "'><LI>" . _('Quyền hạn truy cập') . '</LI></a>'; ?></td>
                        </tr>
                    </table></td>
                </tr>
            </table></td>
        </tr>
    </table>
    <?php
    break;
    } //end of module switch
    } /* end of if security allows to see the full menu */

    // all tables started are ended within this index script which means 2 outstanding from footer.

    include ('includes/footer.inc');

    function OptionHeadings() {

    global $rootpath,$theme;
    ?>
<tr>
    <td class="menu_group_headers"><!-- Orders option Headings -->
    <table>
        <tr>
            <td>
            <?php echo '<img src="' . $rootpath . '/css/' . $theme . '/images/transactions.png" title="' . _('Quản lí thông tin') . '" alt="">'; ?></td>
            <td class="menu_group_headers_text"> <?php echo _('Quản lí thông tin'); ?> </td>
        </tr>
    </table></td>
    <td class="menu_group_headers">
    <table>
        <tr>
            <td>
            <?php echo '<img src="' . $rootpath . '/css/' . $theme . '/images/reports.png" title="' . _('In báo cáo') . '" alt="">'; ?></td>
            <td class="menu_group_headers_text"> <?php echo _('In báo cáo'); ?> </td>
        </tr>
    </table></td>
    <td class="menu_group_headers">
    <table>
        <tr>
            <td>
            <?php echo '<img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Bảo trì') . '" alt="">'; ?></td>
            <td class="menu_group_headers_text"> <?php echo _('Bảo trì'); ?> </td>
        </tr>
    </table></td>
</tr>
<?php
}
?>
